package day7;

import java.util.Arrays;

public class Student {
    //类中默认存在一个无参构造方法，但如果你手动添加
    //默认提供的构造方法就失效了
    public void Student(){
        System.out.println("普通");
    }
    //java种凡是方法名相同 参数不同 称之为重载（overload）
    public Student(){
        System.out.println("无参");
    }
    public Student(int age){
        System.out.println("有参");
    }
    public Student(int age,String name,double score){
        System.out.println("三个参数的构造方法");
        this.age=age;
        this.name=name;
        this.score=score;
    }
    String name;
    int age;
    double score;
    public void printStudent() {
        System.out.println(age);
        System.out.println(name);
        System.out.println(score);
    }
    public void study(){

    }
    public int study(int age){
        this.age=age;
        return age;
    }
    //普通方法重载 参数列表不同（数量，大小，顺序）
}
class TestStudent{
    public static void main(String[] args){
        Student s1 = new Student(12);
        System.out.println(s1);
        Student s2 = new Student(18,"cmy",28.5);
        s1.printStudent();
        s2.printStudent();
        s1.printStudent();
        Arrays.toString(new int[]{1,2,3});
        s2.Student();

    }
}
